#Conv卷积层的反向求导细节
"""

"""

import torch
import torch.nn as nn
import numpy as np
conv = nn.Conv2d(in_channels=1, out_channels=1, kernel_size=3, padding=0, bias=False,stride=1)
padding = nn.ConstantPad2d(0, 0)
inputv = torch.range(1,16).view(1,1,4,4)
out = conv(inputv)
padded = padding(inputv)
print(padded)
print(out)
out = out.mean()
out.backward()
print(conv.weight.grad)